/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Admin_ChartReport.java
 *
 * Created on Apr 7, 2011, 5:51:43 PM
 */
package admin_gui;

import admin.Controller.AreaReportController;
import admin.Controller.ItemReportController;
import admin.Controller.StoreReportController;
import java.util.ArrayList;
import javax.swing.JPanel;

/**
 *
 * @author edaype
 */
public class Admin_ChartReport extends javax.swing.JPanel {

    /** Creates new form Admin_ChartReport */
    private JPanel mainJPanel;
    private ArrayList<String> reportList;
    private int flag;
    private ItemReportController itemReportController;
    private StoreReportController storeReportController;
    private AreaReportController areaReportController;
    private String startDate, endDate;

    public Admin_ChartReport(JPanel mainPanel, ArrayList<String> reportList,
            int flag, String startDate, String endDate) {
        initComponents();
        this.startDate = startDate;
        this.endDate = endDate;
        itemReportController = new ItemReportController();
        storeReportController = new StoreReportController();
        areaReportController = new AreaReportController();
        this.flag = flag;
        this.mainJPanel = mainPanel;
        this.reportList = reportList;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton2 = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));

        jButton2.setFont(new java.awt.Font("Tahoma", 0, 24));
        jButton2.setText("<Back");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(302, 302, 302)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(357, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(535, 535, 535)
                .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                .addGap(28, 28, 28))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        if (flag == 1) {
            itemReportController.goBackItemReportPan(mainJPanel, reportList,
                    startDate, endDate);
        } else if (flag == 2) {
            storeReportController.goBackStoreReportPan(mainJPanel, reportList,
                    startDate, endDate);
        } else {
            areaReportController.goBackAreaReportPan(mainJPanel, reportList,
                    startDate, endDate);
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton2;
    // End of variables declaration//GEN-END:variables
}
